class CreateUsers < ActiveRecord::Migration
  def self.up
    create_table :users do |t|
      t.column :login, :string, :limit => 64
      t.column :hashed_password, :string, :limit => 40
      t.column :salt, :string, :limit => 32
      t.column :firstname, :string, :limit => 64
      t.column :lastname, :string, :limit => 64
      t.column :email, :string, :limit => 128
    end
    add_index :users, :login
    User.create! :login => 'admin', :password => 'admin', :firstname => 'Maitre', :lastname => 'Toutpuissant', :email => 'maitre@dumonde.com' if User.count == 0
  end

  def self.down
    drop_table :users
  end
end
